package org.example.mytask.service.impl;

import org.example.mytask.dao.PurchasingPlanReviewMapper;
import org.example.mytask.domain.PurchasingPlanReview;
import org.example.mytask.service.PurchasingPlanReviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class PurchasingPlanReviewServiceImpl implements PurchasingPlanReviewService {
    @Autowired
    private PurchasingPlanReviewMapper purchasingPlanReviewMapper;
    /**
     * 查询采购计划审核列表
     */
    @Override
    public List<PurchasingPlanReview> selAll(PurchasingPlanReview
                                                     purchasingPlanReview) {
        return purchasingPlanReviewMapper.selectAll(purchasingPlanReview);
    }
    /**
     * 查询采购计划审核
     */
    @Override
    public PurchasingPlanReview selById(int id){
        return purchasingPlanReviewMapper.selectById(id);
    }
    /**
     * 修改采购计划审核
     */
    @Override
    public int updateP(PurchasingPlanReview purchasingPlanReview){
        SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss");
        Date now = new Date();
        String currentTime = sdf.format(now);
        purchasingPlanReview.setReviewer_date(currentTime);
        return purchasingPlanReviewMapper.update(purchasingPlanReview);
    }
}























